package com.example.aiodemo.test;

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String s = input.nextLine();
        StringBuilder lastWord = new StringBuilder();
        int count = 0;//考虑末尾是空格情况,count是字母数量,只要count=0就代表末尾一直是空格
        for (int i = s.length() - 1; i >= 0; i--) {
            char c = s.charAt(i);
            if (c != ' ') {
                lastWord.append(c);
                count++;
            } else {
                if (count != 0)
                    break;
            }
        }
        System.out.println(lastWord.length());
    }
}
